
//  Created by RaoBo on 2018/5/9.

#import "XJFeatureItem.h"
// Models
#import "MyLabelModel.h"

// collectionCell 
@interface XJFeatureItem()
/**属性Lb*/
@property(nonatomic, strong) UILabel *attLb;

@end
@implementation XJFeatureItem
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
 
    self.attLb = [UILabel new];
    self.attLb.textAlignment = NSTextAlignmentCenter;
    self.attLb.layer.masksToBounds = YES;
    self.attLb.layer.cornerRadius = 12;//10; 弧度是12px
    self.attLb.layer.borderColor = kMainLightGrayColor.CGColor;
    self.attLb.layer.borderWidth = 1.0;
    self.attLb.textColor = kLightGrayTextColor; //文字灰色
    [self addSubview:self.attLb];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.attLb mas_makeConstraints:^(MASConstraintMaker *make) {
        // 和父View一样大
//        make.edges.mas_equalTo(self);
        make.left.equalTo(self.contentView.mas_left);
        make.right.equalTo(self.contentView.mas_right);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(30);
    }];
}

- (void)setItemModel:(MyLabelModel *)itemModel {
    _itemModel = itemModel;
    self.attLb.text = itemModel.name;
}

@end
